package com.mall.controller;


import com.mall.pojo.GoodsPo;
import com.mall.pojo.GoodsStockPo;
import com.mall.service.GoodsService;
import com.mall.service.GoodsStockService;
import com.mall.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 库存表 前端控制器
 * </p>
 *
 * @author zhangshiqi
 * @since 2020-09-13
 */
@RestController
@RequestMapping("/goodsStock/")
public class GoodsStockController {

    @Autowired
    private GoodsStockService goodsStockService;

    /**分页查询库存数据*/
    @RequestMapping("doFindPageObject")
    public SysResult doFindPageObject(String stockName, Integer pageCurrent){
        return SysResult.success(goodsStockService.doFindPageObject(stockName, pageCurrent));
    }

    /**删除库存数据*/
    @RequestMapping("doDeleteObjects")
    public SysResult doDeleteObjects(String ids){
        goodsStockService.doDeleteObjects(ids);
        return SysResult.success();
    }

    /**新增库存数据*/
    @RequestMapping("doAddObjects")
    public SysResult doAddObjects(GoodsStockPo goodsStockPo){
        goodsStockService.doAddObjects(goodsStockPo);
        return SysResult.success();
    }

    /**根据ID查询库存数据*/
    @RequestMapping("doFindGoodsStockById")
    public SysResult doFindGoodsStockById(String id){
        return SysResult.success( goodsStockService.doFindGoodsStockById(id));
    }

    /**修改库存数据*/
    @RequestMapping("doUpdateObjects")
    public SysResult doUpdateObjects(GoodsStockPo goodsStockPo){
        goodsStockService.doUpdateObjects(goodsStockPo);
        return SysResult.success();
    }
}

